import { createSlice } from '@reduxjs/toolkit'

const contractSlice = createSlice({
  name: 'contract',
  initialState: {
    data: [],
    pageNumber: 1,
    pageSize: 10,
    total: 0,
    formData: {},
  },
  reducers: {
    setData: (state, action) => {
      state.data = action.payload
    },
    setPageNumber: (state, action) => {
      state.pageNumber = action.payload
    },
    setPageSize: (state, action) => {
      state.pageSize = action.payload
    },
    setTotal: (state, action) => {
      state.total = action.payload
    },
    setFormData: (state, action) => {
      state.formData = action.payload
    },
  },
})

export const { setData, setPageNumber, setPageSize, setTotal, setFormData } = contractSlice.actions
export default contractSlice.reducer
